import request from '@/utils/request'
export const roleList = data => {
    return request({
        url: 'adminRole/postAdminAdminRole',
        method: 'post',
        data,
    })
}

export const roleDelete = data => {
    return request({
        url: `/adminRole/deleteAdminRole`,
        method: 'delete',
        data,
    })
}
export const roleSave = data => {
    return request({
        url: '/adminRole/postAddAdminRole',
        method: 'post',
        data,
    })
}

export const permissionAll = data => {
    return request({
        url: '/adminPermission/getAdminPermission',
        method: 'get',
        data,
    })
}

export const permissionDelete = data => {
    return request({
        url: `/adminPermission/deleteAdminPermissionById/${data.id}`,
        method: 'delete',
        data,
    })
}
export const permissionSave = data => {
    return request({
        url: '/adminPermission/postAddAdminPermission',
        method: 'post',
        data,
    })
}
export const updateRolePermissions = data => {
    return request({
        url: `/permission/updateRolePermissions/${data.roleId}`,
        method: 'put',
        data:data.arr,
    })
}
export const listByRole = params => {
    return request({
        url: `/permission/listByRole/${params.roleId}`,
        method: 'get',
        params
    })
}

export const listByUser = params => {
    return request({
        url: `/role/listByUser/${params.id}`,
        method: 'get',
        params
    })
}
export const saveUserRole = data => {
    return request({
        url: `/role/saveUserRole`,
        method: 'post',
        data
    })
}


